package com.bawei.module_play.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.bawei.module_play.databinding.CommonItemBinding
import com.bawei.module_play.databinding.PalyloveItemBinding
import com.bawei.module_play.entriy.SimpleVideoEntity
import com.bumptech.glide.Glide
import com.example.image.glide.GlideImgLoader

class PlayLoveAdapter constructor(private val list:MutableList<SimpleVideoEntity>):RecyclerView.Adapter<PlayLoveAdapter.ItemViewHolder>() {

    inner class ItemViewHolder(val dataBinding: PalyloveItemBinding): RecyclerView.ViewHolder(dataBinding.root)

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {
        return ItemViewHolder(PalyloveItemBinding.inflate(LayoutInflater.from(parent.context),parent,false))
    }


    override fun getItemCount(): Int {
        return list.size
    }

    override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
      val entriy=list[position]
        GlideImgLoader.loadImage(holder.itemView.context,entriy.videomainimag,holder.dataBinding.loveImg)
        holder.dataBinding.loveDes.text=entriy.title
        holder.dataBinding.lovePlaynum.text="${(10..100).random()}万次观看"
    }
}